package com.cloud.drore.eboss.operation.mapper;

import com.cloud.drore.eboos.common.base.MyMapper;
import com.cloud.drore.eboss.operation.entity.MerchantManage;
import com.cloud.drore.eboss.operation.entity.vo.MerchantManageVo;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/1/6 0006 下午 1:11 <br>
 * @Author: <a href="410508961@qq.com">夏凯</a>
 */

@Repository
public interface MerchantManageMapper extends MyMapper<MerchantManage> {
    String addMerchantManageSql = "update eboos_merchant set merchant_manager = ${merchantManagerId} where id= ${id}";


    @Update(addMerchantManageSql)
        //给商户添加管理员
    int addMerchantManageSql(@Param("merchantManagerId") Long merchantManagerId, @Param("id") Long id);

    //查询所有商户管理员的账号名称
    @Select("select  id,account_name from eboos_merchant_manage")
    List<MerchantManageVo> merchantManageVos();
    //根据商户id查询商户管理员新信息
    @Select("select  * from eboos_merchant_manage where merchant_id=${id}")
    MerchantManageVo queryMerchantManage(@Param("id") Long id);
    //给管理员添加用户管理的id
    @Update("update eboos_merchant_manage set user_id=${userId} where merchant_id=${merchantId}"  )
    int updateMerchantManagerUserId(@Param("merchantId") Long merchantId, @Param("userId") Long userId);
}
